package com.guoyansoft.model.service.impl;

import com.guoyansoft.config.R;
import com.guoyansoft.model.dao.ProductTeamDao;
import com.guoyansoft.model.pojo.Courier;
import com.guoyansoft.model.pojo.ProductTeam;
import com.guoyansoft.model.service.ProductTeamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author ：zyx
 * @date ：Created in 2023-04-26-17:37
 * @description：
 * @modified By：
 * @version: $
 */
@Service
public class ProductTeamServiceImpl implements ProductTeamService {
    @Autowired
    private ProductTeamDao productTeamDao;
    @Override
    public R save(ProductTeam productTeam) {
        int row = productTeamDao.insert(productTeam);
        return row>0?R.suc():R.fail();
    }

    @Override
    public R drop(Integer[] id) {
        int row = productTeamDao.delete(id);
        return row>0?R.suc():R.fail();
    }

    @Override
    public R modify(ProductTeam productTeam) {
        int row = productTeamDao.update(productTeam);
        return row>0?R.suc():R.fail();
    }

    @Override
    public R queryByPage(Map<String, Object> map) {
        List<ProductTeam> productTeams = productTeamDao.selectByPage(map);
        long total = productTeamDao.selectTotal(map);
        return R.suc(total,productTeams);
    }

    @Override
    public R queryById(Integer id) {
        ProductTeam productTeam = productTeamDao.selectById(id);
        return R.suc(productTeam);
    }

    @Override
    public ProductTeam queryByName(String name) {
        ProductTeam productTeam = productTeamDao.selectByName(name);
        return productTeam;
    }
}
